public class Equation {

    int left;
    int right;
    char operate;
    static int countDigits(int number)
    {
        int cnt=0;
        do{
            cnt++;
            number/=10;
        }while(number>0);
        return cnt;
    }
    static String intToString(int number,int high)
    {
        String s="";
        if(number<0)s+="-";
        else s+=" ";
        s+=number;
        for(int i=0;i<countDigits(high)-countDigits(number);i++)
        {
            s+=" ";
        }
        return  s;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj==null)return false;
        Equation other=(Equation) obj;
        if(this.left!= other.left)return false;
        else if(this.right!=other.right)return false;
        else if(this.operate!=other.operate)return false;
        else return true;
    }
        @Override
    public int hashCode() {
        int result = Integer.hashCode(left);
        result = 31 * result + Integer.hashCode(right);
        result = 31 * result + Character.hashCode(operate);
        return result;
    }
    String toString_(int high)
    {
        String s="";
        s+=intToString(left,high);
        s+=" "+operate+" ";
        s+=intToString(right,high);
        s+=" = ";
        return s;
    }
    int value()
    {
        return operate=='+'?left+right:left-right;
    }
}
